/*
 * Copyright (c) 2024 by frostime. All Rights Reserved.
 * @Author       : frostime
 * @Date         : 2024-04-22
 * @FilePath     : /src/func/gpt/components/SessionItemsManager.module.scss
 * @Description  : 会话消息管理器样式
 */

.container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    min-width: 800px;
    min-height: 500px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--b3-border-color);
    background-color: var(--b3-theme-background);
    position: sticky;
    top: 0;
    z-index: 10;

    .toolbarInfo {
        display: flex;
        align-items: center;
        gap: 12px;

        .sessionTitle {
            font-weight: 600;
            font-size: 16px;
            color: var(--b3-theme-on-background);
        }

        .messageCount, .selectedCount {
            font-size: 14px;
            color: var(--b3-theme-on-surface);
            padding: 2px 8px;
            background-color: var(--b3-theme-surface);
            border-radius: 4px;
        }

        .selectedCount {
            background-color: var(--b3-theme-primary-lightest);
            color: var(--b3-theme-primary);
        }
    }

    .toolbarActions {
        display: flex;
        gap: 8px;

        button {
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 4px 8px;
            font-size: 13px;

            svg {
                height: 14px;
                width: 14px;
            }
        }
    }
}

.content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.messageList {
    width: 40%;
    overflow-y: auto;
    border-right: 1px solid var(--b3-border-color);
    padding: 8px;
    background-color: var(--b3-theme-surface-light);
}

.messageItem {
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 6px;
    background-color: var(--b3-theme-background);
    border: 1px solid var(--b3-border-color);
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
        border-color: var(--b3-theme-primary-light);
    }

    &.selected {
        background-color: var(--b3-theme-primary-lightest);
        border-color: var(--b3-theme-primary);
    }

    &.previewing {
        border-color: var(--b3-theme-primary);
        border-width: 2px;
    }

    &.hidden {
        opacity: 0.7;
        background-color: var(--b3-theme-surface);
    }

    .messageHeader {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 6px;

        .messageRole {
            display: flex;
            align-items: center;
            gap: 8px;

            .roleLabel {
                font-weight: 500;
                font-size: 13px;
                padding: 2px 6px;
                border-radius: 4px;
                background-color: var(--b3-theme-surface);
            }

            .messageIndex {
                font-size: 12px;
                color: var(--b3-theme-on-surface-light);
            }

            .hiddenLabel {
                font-size: 12px;
                color: var(--b3-theme-error);
                background-color: var(--b3-theme-error-light);
                padding: 1px 4px;
                border-radius: 3px;
            }
        }

        .messageActions {
            display: flex;
            align-items: center;
            gap: 4px;

            button {
                padding: 2px;
                height: 22px;
                width: 22px;

                svg {
                    height: 14px;
                    width: 14px;
                }
            }
        }
    }

    .messagePreview {
        font-size: 13px;
        color: var(--b3-theme-on-surface);
        margin-bottom: 6px;
        max-height: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
    }

    .messageFooter {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 12px;
        color: var(--b3-theme-on-surface-light);

        .reasoningBadge {
            background-color: var(--b3-theme-primary-light);
            color: var(--b3-theme-primary-dark);
            padding: 1px 4px;
            border-radius: 3px;
            font-size: 11px;
        }
    }
}

.previewPanel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--b3-theme-background);

    .previewHeader {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding: 16px 16px 8px;
        border-bottom: 1px solid var(--b3-border-color);
        flex-shrink: 0;

        .previewInfo {
            display: flex;
            align-items: center;
            gap: 12px;

            .previewRole {
                font-weight: 500;
                padding: 2px 8px;
                border-radius: 4px;
                background-color: var(--b3-theme-surface);
            }

            .previewAuthor {
                font-size: 14px;
                color: var(--b3-theme-on-background);
            }

            .previewTime {
                font-size: 13px;
                color: var(--b3-theme-on-surface-light);
            }

            .hiddenBadge {
                font-size: 12px;
                color: var(--b3-theme-error);
                background-color: var(--b3-theme-error-light);
                padding: 2px 6px;
                border-radius: 3px;
            }
        }

        .previewActions {
            display: flex;
            align-items: center;
            gap: 4px;
        }
    }

    .previewContent {
        font-size: 14px;
        line-height: 1.5;
        color: var(--b3-theme-on-background);
        overflow-y: auto;
        padding: 0 16px 16px;
        flex: 1;
    }

    .reasoningDetails {
        margin-bottom: 16px;
        padding: 8px;
        border-radius: 6px;
        background-color: var(--b3-theme-surface-light);

        summary {
            font-weight: 500;
            cursor: pointer;
            padding: 4px 0;
        }
    }
}
